<%@page contentType="text/html; charset=utf-8" %>
<!DOCTYPE html>
<html>
<head>
    <title>创业之家</title>
    <%@include file="common/header.jsp" %>
</head>
<body>
<!-- page 容器 -->
<div class="page" data-router="true">
    <!-- 标题栏 -->
    <header class="bar bar-nav bgcolor nobottom">
        <button class="button button-link button-nav whitecolor pull-left" href="${ctx}/m/index.do">
            <span class="icon icon-left"></span>

        </button>
        <%@include file="common/headerPic.jsp" %>
        <a class="icon icon-search whitecolor pull-right m_right external" href="${ctx}/m/search.do?type=cyzj"></a>

        <h1 class="title whitecolor">创业之家</h1>
    </header>

    <!-- 工具栏 -->
    <!--<nav class="bar bar-tab">
        <a class="tab-item active" href="#">
            <span class="icon icon-home"></span>
            <span class="tab-label">首页</span>
        </a>
        <a class="tab-item" href="#">
            <span class="icon icon-star"></span>
            <span class="tab-label">收藏</span>
        </a>
        <a class="tab-item" href="#">
            <span class="icon icon-settings"></span>
            <span class="tab-label">设置</span>
        </a>
    </nav>-->

    <!-- 这里是页面内容区 -->
    <div class="content whitebg infinite-scroll" data-distance="100">
        <div class="row no-gutter select_bg">
            <a class="col-33 border_bottom border_right position select_condition" data-type="area">区域 <span
                    class="fa fa-caret-down"></span></a>
            <a class="col-33 border_bottom border_right position select_condition" data-type="special">特色 <span
                    class="fa fa-caret-down"></span></a>
            <a class="col-33 border_bottom border_right position select_condition" data-type="orderField">附近 <span
                    class="fa fa-caret-down"></span></a>
        </div>
        <div class="select_area p_col nav_header area">
            <div class="search_tag <c:if test="${cyzjOrg.areaId=='' || cyzjOrg.areaId==null}">search_default</c:if> ">
                全部
            </div>
            <c:forEach items="${Dict.getList('AREA')}" var="item" varStatus="varStatus">
                <div data-value="${item.KEY}"
                     class="search_tag <c:if test="${cyzjOrg.areaId==item.KEY}">search_default</c:if> ">${item.VALUE}</div>
            </c:forEach>
        </div>
        <div class="select_area p_col nav_header special">
            <div class="search_tag <c:if test="${cyzjOrg.labelMain=='' || cyzjOrg.labelMain==null}">search_default</c:if>"> 全部 </div>
            <c:forEach items="${labelMainList}" var="labelMain">
                <div class="search_tag <c:if test="${cyzjOrg.labelMain==labelMain.label}">search_default</c:if> "
                     data-value="${labelMain.label}">${labelMain.label}</div>
            </c:forEach>
        </div>
        <div class="select_area p_col nav_header orderField">
         <!--    <div class="search_tag search_default" data-value="">定位</div> -->
            <div class="search_tag search_default" data-value="orgName">人气最高</div>
            <div class="search_tag" data-value="distance">离我最近</div>
            <div class="search_tag" data-value="orgName">租金补贴</div>
        </div>
        <div class="contentList" data-totalPage="${activityPager.totalPage}" data-pageNum="1">
            <div class="live">
                <div class="live-left"><img class="logoUrl lazy" src="images/empty.png"
                                            data-original="${Dict.prefix('UPLOAD')}${cyzjOrg.logoUrl}"></div>
                <a class="toDetail" href="">
                    <div class="live-center">
                        <div class="row_nowrap cyzjTitle"></div>
                        <div class="row_nowrap little_size cyzjAddress">地址：</div>
                        <div class="row_nowrap little_size distance"></div>
                        <div class="item-title labelMain">
                            <span class="tag"></span>
                        </div>
                    </div>
                    <div class="live-right creating">创</div>
                </a>
            </div>
        </div>
        <div class="infinite-scroll-preloader">
            <div class="preloader"></div>
        </div>
    </div>

</div>

<%@include file="common/panel.jsp" %>

</body>
</html>

<%@include file="common/footer.jsp" %>
<%@include file="common/nav_header_new.jsp" %>

<!-- 跳转tab2 -->
<script>
    if ("${cyzjOrg.areaId}" != "" || "${cyzjOrg.labelMain}" != "" || "${cyzjPager.scMap.title_I}" != "") {
        $(".tab-link.active").removeClass("active");
        $("#tab1").removeClass("active");
        $("#tab2").addClass("active");
        $("#tab2Link").addClass("active");
    }
</script>

<script>
    $.init();
    var objBase = $(".contentList > .live").eq(0).clone();
    var contentList = $(".contentList");
    contentList.empty();

    var loading = false;

    function addItems(data, content) {
        $.each(data.resultList, function () {
        var obj = objBase.clone();
        obj.find(".cyzjTitle").text(this.orgName);
        obj.find(".cyzjAddress").text("地址：" + this.address);
        if(this.distanceKm!=null){
        obj.find(".distance").text("距离：" + this.distanceKm);
        }
        var labelMainDiv = obj.find(".labelMain").empty();
        if (this.labelMain != null) {
            var labelMainList = this.labelMain.split("|");
            $.each(labelMainList, (function () {
                if (this != '') {
                    var html = '<span class="tag">' + this + '</span>';
                    labelMainDiv.append(html)
                }
            }));
        }

        obj.find(".logoUrl").attr("data-original", "${Dict.prefix('UPLOAD')}" + this.logoUrl);
        obj.find(".toDetail").attr("href", "${ctx}/m/cyzjDetail.do?id=" + this.id);
        content.append(obj);
    });
        var pageNum = parseInt(content.attr("data-pageNum")) + 1;
        content.attr("data-pageNum", pageNum);
        lazyLoad();
    }


    function queryUrl() {
//        var isTab1 = $("#tab1").hasClass("active");
//        if (!isTab1) {nav_header orderField         
		var area = $(".nav_header.area > .search_default").data("value") == undefined ? "" : $(".nav_header.area > .search_default").data("value");
        var special = $(".nav_header.special > .search_default").data("value") == undefined ? "" : $(".nav_header.special > .search_default").data("value");
   	 	var orderField = $(".nav_header.orderField > .search_default").data("value") == undefined ? "" : $(".nav_header.orderField > .search_default").data("value");  
            /*var orderField = $(".nav_header.orderField > .search_default").data("value");*/   //TODO 暂时不写 可能是orderBy
            return "${ctx}/m/cyzjPagerM.do?map.areaId=" + area + "&map.labelMain_L=" + special + "&map.title_I=${cyzjPager.scMap.title_I}&orderField="+orderField;
//            return "cyzjPagerM.do";
//        } else {
//            return "activityPager.do?map.processStatus=running";
//        }
    }
    /*    function queryData(){
     var isTab1 = $("#tab1").hasClass("active");
     if(!isTab1) {
     var area = $(".nav_header.area > .search_default").data("value") == undefined ? "" : $(".nav_header.area > .search_default").data("value");
     var special = $(".nav_header.special > .search_default").data("value") == undefined ? "" : $(".nav_header.special > .search_default").data("value");
     /!*var orderField = $(".nav_header.orderField > .search_default").data("value");*!/   //TODO 暂时不写 可能是orderBy
     var data = {};
     var scMap = {};
     scMap.areaId = area;
     scMap.special = special;
     data.scMap = scMap;
     return data;
     }else{
     return {};
     }

     }*/

    contentList = $(".contentList");
    ajaxTODO(null, contentList, true);

</script>